<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-nested" prefix="nested"%>
<H2>Categories:</H2>
<table border="1">
	<tr>
		<td>Name</td>
		<td>Count</td>
	</tr>
	<nested:root name="productForm">
		<nested:nest property="document.rootElement.children">
			<nested:iterate id="category" indexId="categoryId">
				<c:set var="goodsCount" value="0" />
				<nested:iterate id="subcategory" property="children">
					<bean:size id="size" name="subcategory" property="children" />
					<c:set var="goodsCount" value="${goodsCount+size}" />
				</nested:iterate>
				<tr>
					<td width="250">
						<nested:link action="productAction.do?method=subcategoryList&categoryId=${categoryId}"
									paramId="categoryName" paramName="category"
									paramProperty="attributeValue(name)">
							<bean:write name="category" property="attributeValue(name)" />
						</nested:link>
					</td>
					<td align="center">${goodsCount}</td>
				</tr>
			</nested:iterate>
		</nested:nest>
	</nested:root>
</table>